package org.yonggan.cmcc.util

import org.apache.commons.lang.StringUtils

/**
  * 字符串工具类
  */
object StringUtil {


  /**
    * 字符串拼接
    *
    * @param first
    * @param second
    * @param exp
    * @return
    */
  def append(first: String, second: String, exp: String): String = {
    new StringBuilder(first).append(exp).append(second).toString()
  }


  def subString(str: String, idx: Int): String = {
    if (StringUtils.isNotEmpty(str) && idx <= str.length) str.substring(0, idx) else str
  }

  /*
	 * 判断字符串是否为空
	 *//*
	 * 判断字符串是否为空
	 */
  def isEmpty(str: String): Boolean = {
    StringUtils.isEmpty(str)
  }

  /*
   * 判断字符串是否非空
   */ def isNotEmpty(str: String): Boolean = !isEmpty(str)

}
